using Duo1JFramework.Actor;
using Duo1JFramework.FSM;
using Duo1JFramework.GamerInput;

public class ComActorLogic : CcControlableActor
{
    protected override void OnCreated()
    {
        base.OnCreated();

        Con.AddFSMNode(
            StateNode.Create(
                "Box1",
                (param) =>
                {
                    Con.AnimCrossFade("Boxing01");
                }
            )
            .TimeToState(1f, "Move")
            .TimeHold(1f));

        Con.AddFSMNode(
            StateNode.Create(
                "Box2",
                (param) =>
                {
                    Con.AnimCrossFade("Boxing02");
                }
            )
            .TimeToState(1f, "Move")
            .TimeHold(1f));
    }

    protected override void OnUpdate()
    {
        base.OnUpdate();
        if (InputManager.GetMouseBtn(0))
        {
            Con.SwitchState("Box1");
        }
        else if (InputManager.GetMouseBtn(1))
        {
            Con.SwitchState("Box2");
        }
    }
}
